package com.ebt.m.proposal_v2.bean;

import com.ebt.m.data.entity.Customer;
import com.ebt.m.proposal_v2.utils.DataUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 被保人
 *
 * @author archer.qi
 *         Created on 2017/5/12.
 */
public class InsuredEntity {

    public String clientAccountId;
    public String name;
    public int sex;//性别 0女 1 男
    public int age;
    public String birthday;
    public int profession;
    public int relation;
    public List<InsuranceEntity> risk;

    public InsuredEntity(InsuredEntity org){
        this.clientAccountId = org.clientAccountId;
        this.name = org.name;
        this.sex = org.sex;
        this.age = org.age;
        this.birthday = org.birthday;
        this.profession = org.profession;
        this.relation = org.relation;
        this.risk = new ArrayList<InsuranceEntity>();
        if (org.risk == null){
            return;
        }
        for (InsuranceEntity insuranceEntity : org.risk){
            this.risk.add(new InsuranceEntity(insuranceEntity));
        }
    }

    public InsuredEntity(String clientAccountId, String name, int sex, int age, String birthday, int profession, int relation) {
        this.clientAccountId = clientAccountId;
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.birthday = birthday;
        this.profession = profession;
        this.relation = relation;
    }

    public InsuredEntity(String clientAccountId, int sex, int age, String birthday, int profession, int relation) {
        this.clientAccountId = clientAccountId;
        this.sex = sex;
        this.age = age;
        this.birthday = birthday;
        this.profession = profession;
        this.relation = relation;
    }

    public InsuredEntity(int sex, int age, String birthday, int profession, int relation) {
        this.sex = sex;
        this.age = age;
        this.birthday = birthday;
        this.profession = profession;
        this.relation = relation;
    }

    public InsuredEntity() {

    }

    public Customer toCustomer() {
        return DataUtils.toCustomer(this);
    }
}
